package org.kolonitsky.alexey.mvcext.events
{
    /**
     *  Descriptor contain set of fields which identifer specific page with and
     *  it state. Page descripter is used by PageEvent for switch application 
     *  page (screen).
     *  
     *  @author Alexey Kolonitsky
     */ 
    public class PageDescriptor
    {
        /**
         *  Page identifier
         */ 
        public var pageId:String = "";
        
        /**
         *  Page container's state wich will trigger in requaired page.
         */ 
        public var pageState:String = "";
        
        /**
         *  Page fields preset. Each attribut im map will set to the target page.
         */ 
        public var attributeMap:Object = {};

        /**
         * Constructor create 
         * 
         * @param xmlNode
         * @constructor
         */        
        public function PageDescriptor(id:*=null, pageState:String="", attributeMap:Object=null)
        {
            if (id is String)
            {
                pageId = String(id);
            }
            
            if (id is XML)
            {
                var node:XML = id as XML;
                pageId = node.@screen;
            }
            
            this.pageState = pageState;
            this.attributeMap = attributeMap;
        } 
    }
}